<?php

namespace Database\Factories;

use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;

class UserFactory extends Factory
{
    /**
     * Define the model's default state.
     *
     * @return array
     */
    public function definition()
    {

        $addresses = [
            ["北京市", "市辖区", "东城区"],
            ["河北省", "石家庄市", "长安区"],
            ["江苏省", "南京市", "浦口区"],
            ["江苏省", "苏州市", "相城区"],
            ["广东省", "深圳市", "福田区"],
        ];
        $address   = $this->faker->randomElement($addresses);

        return [
            'name' => $this->faker->name(),
            'avatar' => $this->faker->imageUrl(100,100),
            'sex' => $this->faker->numberBetween(1, 2),
            'channel' => $this->faker->randomElement(['小程序','门店','公众号']),
            'province' => $address[0],
            'city' => $address[1],
            'phone' => $this->faker->phoneNumber,
            'birthday' => $this->faker->date()
        ];
    }

    /**
     * Indicate that the model's email address should be unverified.
     *
     * @return \Illuminate\Database\Eloquent\Factories\Factory
     */
    public function unverified()
    {
        return $this->state(function (array $attributes) {
            return [
                'email_verified_at' => null,
            ];
        });
    }
}
